<?php
/**
 * Verifies that a given username/password combination exists in the relational database system.
 *
 * <p>
 * The <code>UserLogin</code> object provides auxilary functionality to the logic laced within the
 * <code>signIn.php</code> web page by communicating directly with the relational database to
 * search for a record corresponding to the provided credentials.
 * </p>
 *
 * @author Darrius Serrant, Computer Science (Undergraduate)
 */
class UserLogin {

    /**
     * A status code that reports the results of the most recent execution of the <code>checkCredentials</code> function
     * @var <integer>
     */

    private $errorCode;
    /**
     * Decides whether or not the given username and password combination exists in the database.
     * 
     * <p>
     * The function evaluates the result of the following SQL query to the Agents database table:
     * <code>
     *    SELECT * FROM Agents WHERE userName = $user_name ;
     * </code>
     * </p>
     * <p>
     * If a record corresponding to the user name exists, then the function shall next verify that the
     * given password is the same as the password contained in the database. 
     * </p>
     * <p>
     * This function returns a one of three numerical values to indicate the result of its operation:
     * <ol>
     *     <li> A value of (1) indicates that the function was successful at locating the username in the
     *          database and that the given password corresponds with the password stored in the database.
     *     </li>
     *     <li>
     *          A value of (2) indicates that the function was successful at locating the username in the database,
     *          but was unsuccessful at matching the parameterized password with the password stored in the database.
     *      </li>
     *     <li>
     *          A value of (3) indicates that the function was unsuccessful at locating the username in the database.
     *     </li>
     * </ol>
     * 
     * @param user_name    a given user's username
     * @param password     a given user's password
     * @return a status code that represents the status of the credentials verification.
     */
    public function checkCredentials ( $user_name, $password ) {

        return $this->errorCode ;
    }

    /**
     * Decrypts the given password and returns its actual value to the calling function.
     *
     * @param an encryped password retrieved from the Agents database table
     * @return <String> the value of the encrypted password
     */
    private function decryptPassword ( $pass_word ) {

        $decrypedPassword ;

        return decryptedPassword ;
    }
}
?>
